package com.zjapl.web.action;


import com.opensymphony.xwork2.ActionSupport;
import com.zjapl.web.action.vo.Log;
import com.zjapl.web.service.LogService;
import com.zjapl.web.service.impl.LogServiceImpl;

/** 
 * @author 作者:方武斌    E-mail: fangwb@zjapl.com
 * @version 创建时间：2013-1-11 下午3:56:26 
 * 类说明 
 */
public class LogUploadAction extends ActionSupport/* implements
ServletContextAware*/ {

	private static final long serialVersionUID = 1L;
	private int emp_id;
	private String log_content;
	private String log_date;
	private String reason;
	private Log log=new Log();
	private LogService logService=new LogServiceImpl();
   /*
	private File appendix_add;// 实际上传文件
	private ServletContext context;
	private String uploadFileName; // 上传文件名
*/
	

/**  
	 * 获取emp_id  
	 * @return emp_id   
	 */
	public int getEmp_id() {
		return emp_id;
	}
	/**  
	 * 设置emp_id  
	 * @param emp_id emp_id  
	 */
	public void setEmp_id(int emp_id) {
		this.emp_id = emp_id;
	}
	/**  
	 * 获取log_content  
	 * @return log_content   
	 */
	public String getLog_content() {
		return log_content;
	}
	/**  
	 * 设置log_content  
	 * @param log_content log_content  
	 */
	public void setLog_content(String log_content) {
		this.log_content = log_content;
	}
	/**  
	 * 获取log_date  
	 * @return log_date   
	 */
	public String getLog_date() {
		return log_date;
	}
	/**  
	 * 设置log_date  
	 * @param log_date log_date  
	 */
	public void setLog_date(String log_date) {
		this.log_date = log_date;
	}
	/**  
	 * 获取reason  
	 * @return reason   
	 */
	public String getReason() {
		return reason;
	}
	/**  
	 * 设置reason  
	 * @param reason reason  
	 */
	public void setReason(String reason) {
		this.reason = reason;
	}
	
	
public String execute() throws Exception {
	
	  /*String targetDirectory = context.getRealPath("D:/Workspace/log-management-system-zjapl/WebContent/upload");
      String targetFileName = uploadFileName;
      File target = new File(targetDirectory, targetFileName);
      FileUtils.copyFile(appendix_add, target);            
      
      setUploadFileName(target.getPath());//保存文件的存放路径
*/	
	log.setEmp_id(emp_id);
	log.setLog_content(log_content);
	log.setLog_date(log_date);
	log.setReason(reason);
	
	if(logService.logUpload(log)){
			return SUCCESS;
		}
		return ERROR;		
	}
/*@Override
public void setServletContext(ServletContext context) {
	// TODO Auto-generated method stub
	this.context = context;
}*/
   
}
